/**
 * Copyright(C) 2019 FUYUN DATA SERVICES CO., LTD. - All Rights Reserved
 * Unauthorized copying of this file, via any medium is strictly prohibited
 * Proprietary and confidential
 * 该源代码版权归属福韵数据服务有限公司所有
 * 未经授权，任何人不得复制、泄露、转载、使用，否则将视为侵权
 */

import request from "../../../../utils/request";
import { stringify } from "querystring";
import { SERVER_URL } from "../../../../config/base";

// 查询产品列表数据
export async function getProductList(payload: any) {
  return request(`${SERVER_URL}/product?${stringify(payload)}`, {
    method: "get",
    data: {}
  });
}

// 查询产品数据
export async function getProductById(payload: any) {
  return request(`${SERVER_URL}/product/` + payload.id, {
    method: "get",
    data: {}
  });
}

// 保存产品数据
export async function saveProduct(payload: any) {
  return request(`${SERVER_URL}/product`, {
    method: "post",
    data: payload
  });
}

// 修改产品数据
export async function editProduct(payload: any) {
  return request(`${SERVER_URL}/product/` + payload.id, {
    method: "put",
    data: payload
  });
}

// 删除产品数据
export async function deleteProduct(id: string) {
  return request(`${SERVER_URL}/product/` + id, {
    method: "delete",
    data: {}
  });
}
